/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/21 18:16
  *
  * @file       pd_i2c.c
  * @brief      I2C hardware driver.
  *
  * @note       This file contains the hardware driver for the I2C.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/21     Chris        the first version
  *
  ******************************************************************************
  */


#include "pd_i2c.h"

static void I2C_init(I2C *this) {

}

static uint8_t I2C_send(I2C *this, uint8_t salveAddress, uint16_t regAddress, uint8_t *dat, uint8_t len) {
    return 0;
}

static uint8_t I2C_read(I2C *this, uint8_t salveAddress, uint16_t regAddress, uint8_t *dat, uint8_t len) {
    return 0;
}

static I2C *build(GPIO *sck, GPIO *sda) {
    I2C *i2c = malloc(sizeof(I2C));

    Driver_add(i2c, GEN_PERM);

    i2c->sck  = sck;
    i2c->sda  = sda;

    i2c->init = &I2C_init;
    i2c->send = &I2C_send;
    i2c->read = &I2C_read;

    return i2c;
}

const struct I2CClass I2CBuilder = {.build = &build};
